<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增产品补助金申请记录')" />
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: bootstrap-fileinput-css"/>
    <th:block th:include="include :: summernote-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-partsQrcodeApply-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label">配件id：</label>
                <div class="col-sm-8">
                    <input name="partsId" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">规格id：</label>
                <div class="col-sm-8">
                    <input name="attributeId" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">厂家id：</label>
                <div class="col-sm-8">
                    <input name="factoryId" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">申请人id：</label>
                <div class="col-sm-8">
                    <input name="repairId" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">二维码编码：</label>
                <div class="col-sm-8">
                    <input name="qrcodeId" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">故障凭证 url 多个以|隔开：</label>
                <div class="col-sm-8">
                    <input type="hidden" name="faultImages">
                    <div class="file-loading">
                        <input class="form-control file-upload" id="faultImages" name="file" type="file">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">故障描述：</label>
                <div class="col-sm-8">
                    <textarea name="faultDetails" class="form-control"></textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">厂家名称：</label>
                <div class="col-sm-8">
                    <input name="factoryName" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">厂家电话：</label>
                <div class="col-sm-8">
                    <input name="factoryPhone" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">厂家地址：</label>
                <div class="col-sm-8">
                    <input name="factoryAddress" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">状态 0待处理，1市县已鉴定，2市县已驳回，3大区已鉴定，4大区已驳回，5平台已审核，6已拨款：</label>
                <div class="col-sm-8">
                    <select name="applyStatus" class="form-control m-b" th:with="type=${@dict.getType('apply_status')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">是否转账 0 1未转账 2已转账：</label>
                <div class="col-sm-8">
                    <select name="isTransfer" class="form-control m-b" th:with="type=${@dict.getType('zsyh_yesno')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">转账时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="transferTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">转账人：</label>
                <div class="col-sm-8">
                    <input name="transferPerson" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">市县鉴定结果：</label>
                <div class="col-sm-8">
                    <textarea name="auditContent" class="form-control"></textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">市县鉴定时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="auditTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">市县级鉴定人id：</label>
                <div class="col-sm-8">
                    <input name="storeId" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">大区鉴定人：</label>
                <div class="col-sm-8">
                    <input name="agentId" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">大区鉴定内容：</label>
                <div class="col-sm-8">
                    <input type="hidden" class="form-control" name="agentContent">
                    <div class="summernote" id="agentContent"></div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">大区鉴定时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="agentTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">后台审核备注：</label>
                <div class="col-sm-8">
                    <textarea name="platformRemarks" class="form-control"></textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">后台审核时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="platformTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">后台审核人id：</label>
                <div class="col-sm-8">
                    <input name="platformPerson" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">申请渠道：</label>
                <div class="col-sm-8">
                    <input name="applyChannel" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">补助金唯一提取码：</label>
                <div class="col-sm-8">
                    <input name="extractionCode" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <th:block th:include="include :: bootstrap-fileinput-js"/>
    <th:block th:include="include :: summernote-js" />
    <script th:inline="javascript">
        var prefix = ctx + "zsyh/partsQrcodeApply"
        $("#form-partsQrcodeApply-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-partsQrcodeApply-add').serialize());
            }
        }

        $("input[name='transferTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='auditTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='agentTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='platformTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $(".file-upload").fileinput({
            uploadUrl: ctx + 'common/uploadOSS',
            maxFileCount: 1,
            autoReplace: true
        }).on('fileuploaded', function (event, data, previewId, index) {
            $("input[name='" + event.currentTarget.id + "']").val(data.response.url)
        }).on('fileremoved', function (event, id, index) {
            $("input[name='" + event.currentTarget.id + "']").val('')
        })

        $(function() {
            $('.summernote').summernote({
                lang: 'zh-CN',
                callbacks: {
                    onChange: function(contents, $edittable) {
                        $("input[name='" + this.id + "']").val(contents);
                    },
                    onImageUpload: function(files) {
                        var obj = this;
                    	var data = new FormData();
                    	data.append("file", files[0]);
                    	$.ajax({
                            type: "post",
                            url: ctx + "common/uploadOSS",
                    		data: data,
                    		cache: false,
                    		contentType: false,
                    		processData: false,
                    		dataType: 'json',
                    		success: function(result) {
                    		    if (result.code == web_status.SUCCESS) {
                    		        $('#' + obj.id).summernote('insertImage', result.url);
                    		    } else {
                    		        $.modal.alertError(result.msg);
                    		    }
                    		},
                    		error: function(error) {
                    		    $.modal.alertWarning("图片上传失败。");
                    		}
                    	});
                    }
                }
            });
        });
    </script>
</body>
</html>